package com.lecture.javamode.principle.ocp.after;

import com.lecture.javamode.principle.ocp.before.Notification;
import com.lecture.javamode.principle.ocp.before.NotificationEmergencyLevel;

/**
 * @author luyn
 * @version 1.0
 * @description
 * @date 2022/1/11 14:10
 */
public class ErrorAlertHandler extends AlertHandler {
    public ErrorAlertHandler(AlertRule rule, Notification notification){
        super(rule, notification);
    }

    @Override
    public void check(ApiStatInfo apiStatInfo) {
        if (apiStatInfo.getMaxErrorCount() > rule.getMatchedRule(apiStatInfo.getApi()).getMaxErrorCount()) {
            notification.notify(NotificationEmergencyLevel.SEVERE, "...");
        }
    }
}
